package com.feicheng.iou.controller;


import com.feicheng.iou.bean.InformationBean;
import com.feicheng.iou.constant.StatusCodeConstant;
import com.feicheng.iou.exception.SystemExceptionV110;
import com.feicheng.iou.result.ResultInfoV110;
import com.feicheng.iou.service.BaomingService;
import com.feicheng.iou.service.ContractService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tianchunlei
 * @since 2021-06-28
 */
@RestController
@RequestMapping("/iou/contract")
@Slf4j
public class ContractController {

    @Autowired
    ContractService contractService;

    @GetMapping("/info/{id}")
    public ResultInfoV110 selectContractInfo(@PathVariable("id") Integer id) {  //查询单个报名信息
        log.info("selectContractInfo方法进入，参数为: " + id);

        // 参数校验是否为空
        if (id == null) {
            throw new SystemExceptionV110(InformationBean.setInformationBean(StatusCodeConstant.F002, "查询协议id"));
        }

        //调用baomingService实现线索单个查询业务逻辑
        return contractService.selectInfo(id);
    }
}

